package com.eight.cloud.payment.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eight.cloud.mybatisplus.entity.TenantDataScopeEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * 退款记录表
 *
 * @ClassName: SubRefundOrderEntity
 * @Author TXC
 * @Date 2024-12-24 16:24
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("sys_payment_sub_refund_order")
public class SubRefundOrderEntity extends TenantDataScopeEntity<SubRefundOrderEntity> {

    private static final long serialVersionUID = 1L;

    /**
     * 退款来源 1: 三方应用退款 2：平台退款
     */
    @TableField("source_from")
    private Integer sourceFrom;

    /**
     * 付款订单号 关联sub_order表
     */
    @TableField("out_trade_no")
    private String outTradeNo;

    /**
     * 子商户原付款订单号
     */
    @TableField("sub_out_trade_no")
    private String subOutTradeNo;

    /**
     * 子商户退款订单号
     */
    @TableField("sub_refund_no")
    private String subRefundNo;

    /**
     * 商户号
     */
    @TableField("merchant_id")
    private String merchantId;

    /**
     * 平台订单流水号
     */
    @TableField("transaction_id")
    private String transactionId;

    /**
     * 退款金额 单位为分
     */
    @TableField("refund")
    private Long refund;

    /**
     * 原订单总金额 单位为分
     */
    @TableField("total")
    private Long total;

    /**
     * 子商户appid
     */
    @TableField("appid")
    private String appid;

    /**
     * 支付方式
     */
    @TableField("trade_type")
    private String tradeType;

    /**
     * 支付平台类型
     */
    @TableField("pay_channel")
    private String payChannel;

    @Getter
    public enum RefundStatusEnum {
        FAILED(0, "失败"),
        SUCCESS(1, "成功");
        private final Integer value;
        private final String name;
        RefundStatusEnum(Integer value, String name) {
            this.value = value;
            this.name = name;
        }
    }

    @Getter
    public enum RefundSourceFormEnum {
        APP(1, "三方应用退款"),
        PLATFORM(2, "平台退款");
        private final Integer value;
        private final String name;
        RefundSourceFormEnum(Integer value, String name) {
            this.value = value;
            this.name = name;
        }
    }
}
